﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Hydra.Shell.Interfaces;
using System.Collections.Generic;
using Hydra.Shell.Enumerations;
using Divelements.SandDock;
using Hydra.Shell.Attributes;
using SLControlLibrary;

namespace Hydra.Shell.Implementations
{
    [Guid("9D43D521-1758-43D8-80A1-57105485093C")]
    public class HydraUIShell : HydraServiceBase<HydraUIShell>, IHydraUIShell
    {
        private UserControl page;
        private DockSite dockSite;
        private IHydraShell hydraShell;
        private uint cookie;

        public HydraUIShell(UserControl page, DockSite dockSite, IHydraShell hydraShell) : base(new UIThread(page.Dispatcher))
        {
            this.page = page;
            this.dockSite = dockSite;
            this.hydraShell = hydraShell;

            var serviceLoadOp = (ServiceLoadOperation<IHydraProfferService>) null;

            if (((IQueryServiceProvider)hydraShell).QueryService<IHydraProfferService>(typeof(IHydraProfferService).GetGuid(), out serviceLoadOp))
            {
                serviceLoadOp.ServiceLoaded += (sender, e) =>
                {
                    var profferService = serviceLoadOp.Service;

                    profferService.ProfferService(typeof(IHydraUIShell).GetGuid(), this, out cookie);
                };
            }
        }

        public IEnumerable<IHydraWindowFrame> GetToolWindows()
        {
            throw new NotImplementedException();
        }

        public IEnumerable<IHydraWindowFrame> GetDocumentWindows()
        {
            throw new NotImplementedException();
        }

        public bool FindToolWindow(HydraFindToolWindow grfFTW, ref Guid rguidPersistenceSlot, out IHydraWindowFrame ppWindowFrame)
        {
            throw new NotImplementedException();
        }

        public bool CreateToolWindow(HydraCreateToolWindow grfCTW, uint dwToolWindowId, object punkTool, ref Guid rclsidTool, ref Guid rguidPersistenceSlot, ref Guid rguidAutoActivate, IQueryServiceProvider psp, string pszCaption, int[] pfDefaultPosition, out IHydraWindowFrame ppWindowFrame)
        {
            throw new NotImplementedException();
        }

        public bool CreateDocumentWindow(HydraCreateDocWindow grfCDW, string pszMkDocument, IHydraUIHierarchy pUIH, uint itemid, IUnknown punkDocView, IUnknown punkDocData, ref Guid rguidEditorType, string pszPhysicalView, ref Guid rguidCmdUI, IQueryServiceProvider psp, string pszOwnerCaption, string pszEditorCaption, int[] pfDefaultPosition, out IHydraWindowFrame ppWindowFrame)
        {
            throw new NotImplementedException();
        }

        public bool SetErrorInfo(int hr, string pszDescription, uint dwReserved, string pszHelpKeyword, string pszSource)
        {
            throw new NotImplementedException();
        }

        public bool ReportErrorInfo(int hr)
        {
            throw new NotImplementedException();
        }

        public bool GetDialogOwnerHwnd(out UIElement phwnd)
        {
            throw new NotImplementedException();
        }

        public bool EnableModeless(bool fEnable)
        {
            throw new NotImplementedException();
        }

        public bool SaveDocDataToFile(HydraSaveFlags grfSave, object pPersistFile, string pszUntitledPath, out string pbstrDocumentNew, out bool pfCanceled)
        {
            throw new NotImplementedException();
        }

        public bool SetupToolbar(UIElement hwnd, IHydraToolWindowToolbar ptwt, out IHydraToolWindowToolbarHost pptwth)
        {
            throw new NotImplementedException();
        }

        public bool SetForegroundWindow()
        {
            throw new NotImplementedException();
        }

        public bool TranslateAcceleratorAsACmd(Key[] pMsg)
        {
            throw new NotImplementedException();
        }

        public bool UpdateCommandUI(bool fImmediateUpdate)
        {
            throw new NotImplementedException();
        }

        public bool UpdateDocDataIsDirtyFeedback(uint docCookie, bool fDirty)
        {
            throw new NotImplementedException();
        }

        public bool RefreshPropertyBrowser(int dispid)
        {
            throw new NotImplementedException();
        }

        public bool SetWaitCursor()
        {
            throw new NotImplementedException();
        }

        public bool PostExecCommand(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, ref object pvaIn)
        {
            throw new NotImplementedException();
        }

        public bool ShowContextMenu(uint dwCompRole, ref Guid rclsidActive, int nMenuId, Point[] pos, ICommandTarget pCmdTrgtActive)
        {
            throw new NotImplementedException();
        }

        public bool ShowMessageBox(uint dwCompRole, ref Guid rclsidComp, string pszTitle, string pszText, string pszHelpFile, uint dwHelpContextID, MessageButton msgbtn, MessageDefaultButton msgdefbtn, MessageIcon msgicon, bool fSysAlert, out Hydra.Shell.Enumerations.MessageBoxResult pnResult)
        {
            throw new NotImplementedException();
        }

        public bool SetMRUComboText(ref Guid pguidCmdGroup, uint dwCmdID, string lpszText, int fAddToList)
        {
            throw new NotImplementedException();
        }

        public bool SetToolbarVisibleInFullScreen(Guid[] pguidCmdGroup, uint dwToolbarId, int fVisibleInFullScreen)
        {
            throw new NotImplementedException();
        }

        public bool FindToolWindowEx(uint grfFTW, ref Guid rguidPersistenceSlot, uint dwToolWinId, out IHydraWindowFrame ppWindowFrame)
        {
            throw new NotImplementedException();
        }

        public bool GetAppName(out string pbstrAppName)
        {
            throw new NotImplementedException();
        }

        public bool GetVSSysColor(HydraSysColor dwSysColIndex, out uint pdwRGBval)
        {
            throw new NotImplementedException();
        }

        public bool SetMRUComboTextW(Guid[] pguidCmdGroup, uint dwCmdID, string pwszText, int fAddToList)
        {
            throw new NotImplementedException();
        }

        public bool PostSetFocusMenuCommand(ref Guid pguidCmdGroup, uint nCmdID)
        {
            throw new NotImplementedException();
        }

        public bool GetCurrentBFNavigationItem(out IHydraWindowFrame ppWindowFrame, out string pbstrData, out object ppunk)
        {
            throw new NotImplementedException();
        }

        public bool AddNewBFNavigationItem(IHydraWindowFrame pWindowFrame, string bstrData, object punk, int fReplaceCurrent)
        {
            throw new NotImplementedException();
        }

        public bool OnModeChange(DebugMode dbgmodeNew)
        {
            throw new NotImplementedException();
        }

        public bool GetErrorInfo(out string pbstrErrText)
        {
            throw new NotImplementedException();
        }

        public bool GetOpenFileNameViaDlg(HydraOpenFileName[] pOpenFileName)
        {
            throw new NotImplementedException();
        }

        public bool GetSaveFileNameViaDlg(HydraSaveFileName[] pSaveFileName)
        {
            throw new NotImplementedException();
        }

        public bool GetDirectoryViaBrowseDlg(HydraBrowseInfo[] pBrowse)
        {
            throw new NotImplementedException();
        }

        public bool CenterDialogOnWindow(IntPtr hwndDialog, IntPtr hwndParent)
        {
            throw new NotImplementedException();
        }

        public bool GetPreviousBFNavigationItem(out IHydraWindowFrame ppWindowFrame, out string pbstrData, out IUnknown ppunk)
        {
            throw new NotImplementedException();
        }

        public bool GetNextBFNavigationItem(out IHydraWindowFrame ppWindowFrame, out string pbstrData, out IUnknown ppunk)
        {
            throw new NotImplementedException();
        }

        public bool GetURLViaDlg(string pszDlgTitle, string pszStaticLabel, string pszHelpTopic, out string pbstrURL)
        {
            throw new NotImplementedException();
        }

        public bool RemoveAdjacentBackForthNavigationItem(RemoveBackForthDirection rdDir)
        {
            throw new NotImplementedException();
        }

        public bool RemoveCurrentNavigationDupes(RemoveBackForthDirection rdDir)
        {
            throw new NotImplementedException();
        }

        public bool GetOpenFileNameViaDlgEx(HydraOpenFileName[] pOpenFileName, string pszHelpTopic)
        {
            throw new NotImplementedException();
        }

        public bool GetSaveFileNameViaDlgEx(HydraSaveFileName[] pSaveFileName, string pszHelpTopic)
        {
            throw new NotImplementedException();
        }

        public bool GetDirectoryViaBrowseDlgEx(HydraBrowseInfo[] pBrowse, string pszHelpTopic, string pszOpenButtonLabel, string pszCeilingDir, HydraNamespaceExtensionBrowseInfo[] pNSEBrowseInfo)
        {
            throw new NotImplementedException();
        }

        public bool SaveItemsViaDlg(uint cItems, HydraSaveTreeItem[] rgSaveItems)
        {
            throw new NotImplementedException();
        }

        public bool GetVSSysColorEx(int dwSysColIndex, out uint pdwRGBval)
        {
            throw new NotImplementedException();
        }

        public bool CreateGradient(uint GRADIENTTYPE, out IHydraGradient pGradient)
        {
            throw new NotImplementedException();
        }

        public bool GetVSCursor(uint cursor, out IntPtr phIcon)
        {
            throw new NotImplementedException();
        }

        public bool IsAutoRecoverSavingCheckpoints(out int pfARSaving)
        {
            throw new NotImplementedException();
        }

        public bool HydraDialogBoxParam(uint hinst, uint dwId, uint lpDialogFunc, int lp)
        {
            throw new NotImplementedException();
        }

        public bool CreateIconImageButton(IntPtr hwnd, IntPtr hicon, uint bwiPos, out IHydraImageButton ppImageButton)
        {
            throw new NotImplementedException();
        }

        public bool CreateGlyphImageButton(IntPtr hwnd, ushort chGlyph, int xShift, int yShift, uint bwiPos, out IHydraImageButton ppImageButton)
        {
            throw new NotImplementedException();
        }

        public bool ReportErrorInfo2(int hr, bool Suppress)
        {
            throw new NotImplementedException();
        }

        public bool SuppressRestart(bool Suppress)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<IHydraWindowFrame> GetWindows(uint type)
        {
            throw new NotImplementedException();
        }

        public bool SetupToolbar2(UIElement hwnd, IHydraToolWindowToolbar ptwt, ICommandTarget pCmdTarget, out IHydraToolWindowToolbarHost pptwth)
        {
            throw new NotImplementedException();
        }

        public bool SetupToolbar3(IHydraWindowFrame pFrame, out IHydraToolWindowToolbarHost pptwth)
        {
            throw new NotImplementedException();
        }

        public bool CreateToolbarTray(ICommandTarget pCmdTarget, out IHydraToolbarTrayHost ppToolbarTrayHost)
        {
            throw new NotImplementedException();
        }
    }
}
